package com.heima.admin.controller;


import com.heima.admin.service.IAdUserLoginService;
import com.heima.admin.service.IAdUserService;
import com.heima.model.admin.dtos.UserDto;
import com.heima.model.admin.pojos.AdUser;
import com.heima.model.admin.pojos.AdUserLogin;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 管理员登录行为信息表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-26
 */
@Slf4j
@RestController
@RequestMapping("/login/in")
@RequiredArgsConstructor
public class AdUserLoginController {

    private final IAdUserService adUserService;

    @ApiModelProperty("管理员登录")
    @PostMapping
    public ResponseResult login(@RequestBody UserDto dto) {
        log.info("管理员 {} 尝试登录", dto.getName());
        return adUserService.login(dto);
    }

}
